pacman::p_load(lazyoptcli, reshape, ggsignif)
opt <- addopt_ggplot2(matrix(c(
  "inputpath", "i", 2, "character", "", ""
), byrow = TRUE, ncol = 6), arg = c("-i", "E:/projects/R_draw_sc/test/xianzhuxingboxplot/data/Diff.mat.txt",
                                    "-o", "C:/Users/Administrator/Desktop/bushu"))
data <- opt %$% read.delim(inputpath) %>%
  melt() %>%
  set_colnames(c("group", "value"))
 ggp <-  ggplot(data,aes(x = group, y = value, group = group, color = group))

ggp <- ggp +
  geom_boxplot() +
  geom_signif(comparisons = list(c("B1", "B2"), c("B2", "B5")),
              step_increase = 0.1, map_signif_level = T, test = t.test, show.legend = T)
#lazyopt_ggplot2(opt, ggp, FALSE)

#用于自己实现显著性相关图,比较自主的写法
ggplot(mpg, aes(class, hwy)) +
  geom_boxplot() +
  geom_signif(annotations = c("First", "Second"),
              y_position = c(30, 40), xmin=c(4,1), xmax=c(5,3))